import request from '@/config/axios'
import type { Dayjs } from 'dayjs';

/** 排行榜信息 */
export interface Rank {
          id: number; // ID
          userId?: number; // 用户id
          userName?: string; // 用户名称
          month?: string | Dayjs; // 月份
          money?: number; // 放款金额
  }

// 排行榜 API
export const RankApi = {
  // 查询排行榜分页
  getRankPage: async (params: any) => {
    return await request.get({ url: `/system/rank/page`, params })
  },

  // 查询排行榜详情
  getRank: async (id: number) => {
    return await request.get({ url: `/system/rank/get?id=` + id })
  },

  // 新增排行榜
  createRank: async (data: Rank) => {
    return await request.post({ url: `/system/rank/create`, data })
  },

  // 修改排行榜
  updateRank: async (data: Rank) => {
    return await request.put({ url: `/system/rank/update`, data })
  },

  // 删除排行榜
  deleteRank: async (id: number) => {
    return await request.delete({ url: `/system/rank/delete?id=` + id })
  },

  /** 批量删除排行榜 */
  deleteRankList: async (ids: number[]) => {
    return await request.delete({ url: `/system/rank/delete-list?ids=${ids.join(',')}` })
  },

  // 导出排行榜 Excel
  exportRank: async (params) => {
    return await request.download({ url: `/system/rank/export-excel`, params })
  }
}